# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

pkgname=gdbm
pkgver=1.21
pkgrel=1
pkgdesc='GNU database library'
url="https://www.gnu.org/software/gdbm/gdbm.html"
license=('GPL3')
arch=('x86_64')
depends=('glibc' 'sh')
makedepends=('readline')
provides=('libgdbm_compat.so' 'libgdbm.so')
source=("https://ftp.gnu.org/gnu/gdbm/${pkgname}-${pkgver}.tar.gz"{,.sig})
sha512sums=('b2a31802d1af9f97b24d3dd01cb048bab4a8e748297f1b70851c0342400dde4281242b7f80bd92a36035e22398d240d131b550ab444ee838a077522a6921fa43'
            'SKIP')
b2sums=('1f9b04507601b9660a9a81edc29e9b7c0d9adececf21e372670bcf1acf3d0551d858af3e7cf9202b460691cc851ca6dfcc5014ae28161b06f31c9442d3a9fe96'
        'SKIP')
validpgpkeys=('325F650C4C2B6AD58807327A3602B07F55D0C732') # Sergey Poznyakoff <gray@gnu.org>

prepare() {
  cd "$pkgname-$pkgver"
  autoreconf -fiv
}

build() {
  cd "$pkgname-$pkgver"
  ./configure --prefix=/usr \
              --enable-libgdbm-compat
  make
}

check() {
  cd "$pkgname-$pkgver"
  make check
}

package() {
  depends+=('libreadline.so')
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  install -vDm 644 {NOTE-WARNING,AUTHORS,NEWS,README,ChangeLog} \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
}
